/*
 * Copyright (c) 2023 OceanBase.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.oceanbase.odc.core.datamasking;

import com.oceanbase.odc.core.datamasking.algorithm.Segment;
import com.oceanbase.odc.core.datamasking.algorithm.SegmentType;

/**
 * @author gaoda.xy
 * @date 2023/2/1 17:30
 */
public class SegmentTestUtil {
    public static Segment digit(int digitNumber, boolean mask, String replaceCharacters) {
        Segment segment = new Segment();
        segment.setType(SegmentType.DIGIT);
        segment.setMask(mask);
        segment.setDigitNumber(digitNumber);
        segment.setReplacedCharacters(replaceCharacters);
        return segment;
    }

    public static Segment digitPercentage(int digitPercentage, boolean mask, String replaceCharacters) {
        Segment segment = new Segment();
        segment.setType(SegmentType.DIGIT_PERCENTAGE);
        segment.setMask(mask);
        segment.setDigitPercentage(digitPercentage);
        segment.setReplacedCharacters(replaceCharacters);
        return segment;
    }

    public static Segment leftOver(boolean mask, String replaceCharacters) {
        Segment segment = new Segment();
        segment.setType(SegmentType.LEFT_OVER);
        segment.setMask(mask);
        segment.setReplacedCharacters(replaceCharacters);
        return segment;
    }

    public static Segment delimiter(String delimiter, boolean mask, String replaceCharacters) {
        Segment segment = new Segment();
        segment.setType(SegmentType.DELIMITER);
        segment.setMask(mask);
        segment.setDelimiter(delimiter);
        segment.setReplacedCharacters(replaceCharacters);
        return segment;
    }
}
